from django.contrib import admin
from .models import Course

@admin.register(Course)
class CourseAdmin(admin.ModelAdmin):
    list_display = ('title', 'age_group', 'get_age_group_display')
    list_filter = ('age_group',)
    search_fields = ('title',)
    
    # 如果你想在添加/编辑表单中自定义显示
    fieldsets = (
        (None, {
            'fields': ('title', 'age_group')
        }),
        # 其他字段集...
    )
    
    # 如果你想自定义表单widget（虽然Django默认就会为choices字段生成select）
    # formfield_overrides = {
    #     models.CharField: {
    #         'widget': Select(choices=Course.AGE_GROUP_CHOICES)
    #     },
    # }
